package com.gitee.wsl.doc.prosemirror.ui

import com.gitee.wsl.doc.prosemirror.state.EditorState
import com.gitee.wsl.doc.prosemirror.state.Transaction
import com.gitee.wsl.doc.prosemirror.ui.command.UiCommand
import com.gitee.wsl.doc.prosemirror.ui.command.toCommand

class EditorView(
    val model:EditorViewModel
) {

    val state: EditorState
        get() = model.state

    fun dispatch(tran: Transaction) {
         model.apply(tran)
    }

    fun command(cmd: UiCommand) {
        model.command(cmd.toCommand(this))
    }

     fun focus() {
        TODO("Not yet implemented")
    }
}